non_gps: added feature matching and offset calculation#62
non_gps: added feature matching and offset calculation#62snktshrma wants to merge 8 commits intoArduPilot:masterfrom
Conversation
| kp2, des2 = sift.detectAndCompute(img2,None) | ||
| FLANN_INDEX_KDTREE = 1 | ||
| index_params = dict(algorithm = FLANN_INDEX_KDTREE, trees = 5) | ||
| search_params = dict(checks = 50) |
There was a problem hiding this comment.
If you plan to run this to run at a regular rate, it might be wise to iteratively adjust the checks over time to optimize the computation time against the desired output rate. It might depend if you want to run this algorithm on every frame, or skip frames in order to get higher checks.
There was a problem hiding this comment.
Understood sir! You mean it could be better to do frequent checks on image frames rather than continuous checks on frames, I'll make it to check for features at frequent intervals
| if len(good)>MIN_MATCH_COUNT: | ||
| src_pts = np.float32([ kp1[m.queryIdx].pt for m in good ]).reshape(-1,1,2) | ||
| dst_pts = np.float32([ kp2[m.trainIdx].pt for m in good ]).reshape(-1,1,2) | ||
| M, mask = cv.findHomography(src_pts, dst_pts, cv.RANSAC,5.0) |
There was a problem hiding this comment.
For finding homography, since the images are in quick succession and not arbitrarily different transforms, are there any algorithms that may be optimized based on an initial guess?
There was a problem hiding this comment.
@Ryanf55 I am not sure if it is what you are mentioning, but Iterative Closest Point algorithm can serve the purpose. If it is required, I'll add it in the main algorithm
Made code modular and corrected offset and zoom scaling
This is a draft PR, referenced to the #23471 by @rmackay9. As of now, PR provides basic outline for the image feature detection and getting offsets, orientation and zoom. Alongside, we are able to extract new lat and long based on pixel offset. Functions to store old lat and log, alongside altitude data is also added.
Two test images are added for testing purposes.
This is a small part to the whole solution for the issue and it'll be updated frequently under this PR for the complete feature development.